﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Linq.Expressions;
using Infancy.Core.Entities;
using Infancy.Core.Reflection;

namespace Infancy.Core.Service {
    public interface IQueryInfo<T> where T : IEntity {
        T Instanse { get; }

        IList<WhereQuery> WhereQueries { get; }

        IList<OrderQuery> OrderQueries { get; }

        IQueryInfo<T> Where(Expression<Func<T,bool>> predicate);

        IQueryInfo<T> OrderBy(Expression<Func<T, object>> keySelector);

        IQueryInfo<T> OrderByDescending(Expression<Func<T, object>> keySelector);
    }

    public enum WhereType {
        /// <summary>
        /// 等于
        /// </summary>
        Equal,

        /// <summary>
        /// 大于
        /// </summary>
        GreaterThan,

        /// <summary>
        /// 大于等于
        /// </summary>
        GreaterThanOrEqual,

        /// <summary>
        /// 小于
        /// </summary>
        LessThan,

        /// <summary>
        /// 小于等于
        /// </summary>
        LessThanOrEqual,

        /// <summary>
        /// 不等于
        /// </summary>
        NotEqual,

        /// <summary>
        /// 且
        /// </summary>
        And,

        /// <summary>
        /// 或
        /// </summary>
        Or,

        /// <summary>
        /// 逻辑否
        /// </summary>
        Not
    }

    public enum OrderType {
        /// <summary>
        /// 正序
        /// </summary>
        Ascending,
        /// <summary>
        /// 倒序
        /// </summary>
        Descending
    }
}
